// System Include
#include <iostream>
// Local Include
#include "UtilsGPU.cuh"

float UtilsGPU::L2NormS(float* D_A, float* D_B, const int& ArraySize) {
	// Init
	float Result = -1.0f;
	cublasHandle_t CublasHandle;
	HANDLE_ERROR(cublasCreate(&CublasHandle));

	// Calculate
	HANDLE_ERROR(cublasSaxpy(CublasHandle, ArraySize, &Result, D_A, 1, D_B, 1));
	HANDLE_ERROR(cublasSnrm2(CublasHandle, ArraySize, D_B, 1, &Result));

	return Result;
}